home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_pas
/
cddk9605.zip
/
TUTOR.ZIP
/
TUTOR4.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-05-16
|
2KB
|
77 lines
PROGRAM Tutor4;
{$A+,B-,F+,I-,Q-,R-,S-,X+}
USES
Concerto, IO, Scripts, xStrings;
VAR
Entry : pChar3;
Number : Byte;
BEGIN
{ Our brief introduction to Concerto is finished. Now we're going to
start working on an actual door game! We trust, at this point, that
you will refer to the INT (interface) files if you are looking for
details not described in this and subsequent tutorials. }
{ As always, the first step is to initialize the door. }
RegisterConcerto;
Script('Init');
{ Our door game is going to be simple -- after you, you probably want
to get started on your *own* game as soon as possible. We are going
to make a number guessing name (no groans!). :}
{ Select a random number }
Number:=Random(100)+1;
REPEAT
{ Display the prompt }
SO_pChar('Enter your guess: ');
{ Get a number from the user. We are going to use the SI_pChar
procedure, which is a low-level pChar input routine. It
accepts two parameters:
1) a pChar to hold the result, and
2) the maximum length of the string.
SI_pChar has a unique feature. If the first parameter is not
empty, then the user will be allow to edit the existing characters!
This can be good at times, but you will have to erase the string
if you need the user to enter something from scratch. See below. }
Entry[0]:=#0;
SI_pChar(Entry,3);
{ Check the answer... }
IF p_Int(Entry)=Number THEN
BEGIN
SO_pCharLn('|FFThe geezer actually won!|07~p');
ExitDoor(0);
END
ELSE
IF p_Int(Entry)>Number THEN
SO_pCharLn('Too big, dummy.')
ELSE
SO_pCharLn('Think bigger, peabrain.');
UNTIL False;
{ This line will never be reached -- look closely at the UNTIL statement! }
END.